#include <gtk/gtk.h>
#include <stdio.h>
#include <stdlib.h>

/*-------------------------------------------------------------------------------------*/
//主函数:main()
int main(int argc,char *argv[ ])

{

    GtkWidget *window;
    GtkWidget *scrolled;
    GtkWidget *text;

    gtk_init(&argc,&argv);

    window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_widget_set_size_request(window,200,200);
    g_signal_connect_swapped(G_OBJECT(window),"destroy",G_CALLBACK(gtk_main_quit),NULL);

    scrolled=gtk_scrolled_window_new(NULL,NULL); /*创建滚动窗口构件*/
    gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled), GTK_POLICY_ALWAYS, GTK_POLICY_ALWAYS);
    gtk_container_add(GTK_CONTAINER(window),scrolled);/*将滚动窗口构件加入窗体*/
    gtk_widget_show(scrolled);/*显示滚动窗口构件*/

    text=gtk_text_view_new();/*创建文本视图构件*/
    gtk_container_add(GTK_CONTAINER(scrolled),text);/*将文本视图构件加入滚动窗口*/
    gtk_widget_show(text);

    gtk_widget_show(window);
    gtk_main();

    return 0;
}